package scheduler;

import java.util.List;

class SaverThread implements Runnable
{
	ILinkRepository rep;
	List<String> l;
	SaverThread(ILinkRepository rep, List<String> l)
	{
		this.l = l;
		this.rep = rep;
	}
	@Override
	public void run()
	{
		rep.saveLinks(l);
	}
}


public class SimpleScheduler implements IScheduler
{
	private ILinkRepository rep;
	
	SimpleScheduler(ILinkRepository rep)
	{
		this.rep = rep;
	}
	
	public String getTask()		//opcjonalnie jakaś klasa reprezentująca URL
	{
		return rep.getLink();
	}

	@Override
	public void saveLinks(List<String> l)
	{
		new Thread(new SaverThread(rep, l)).start();
	}
}
